﻿<?php
include("../Modules/admin_resist_mdl.php");
// include('doctype.htm');
include("../../Modules/conn.php");
?>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript" type="text/javascript"> 
	

</script>

</head>

<body>
<script language="javascript">
	
	// Kiem tra cac truong trong form co bi bo trong hay khong
	function emptyCheck()
	{
		if ( (document.frmAddCNBM.txtMSBM.value == "")  ||
			 (document.frmAddCNBM.txtTenBM.value == "") ||
			 (document.frmAddCNBM.cboKhoa.value == -1) 	||
			 (document.frmAddCNBM.txtMK1.value == "")	||
			 (document.frmAddCNBM.txtMK2.value == "")		)
		
				document.frmAddCNBM.smtCNBM.disabled = true;
		
		else document.frmAddCNBM.smtCNBM.disabled = false;
	}
	
	// Kiem tra mat khau co khop nhau khong
	function passCheck()
	{
		if (document.frmAddCNBM.txtMK1.value != document.frmAddCNBM.txtMK2.value)
		{
			alert("Mật khẩu không khớp");
			return false;
		}
		return true;
	}
</script>

<h4>Thêm bộ môn</h4>

<form method="POST" action="../Modules/admin_addcnbm.php" name="frmAddCNBM" onsubmit="return passCheck();" onreset="this.smtCNBM.disabled = true">
	<ul>
		<li>
			<span>Mã bộ môn</span>
			<input type="text" name="txtMSBM" onkeyup="emptyCheck();">
		</li>
		
		<li>
			<span>Tên bộ môn</span>
			<input type="text" name="txtTenBM" onkeyup="emptyCheck();">
		</li>
		
		
		
		<li>
			<span>Khoa</span>
			<select name="cboKhoa" onchange="emptyCheck();">
				<option value="-1" selected> -- Chưa chọn -- </option>
				<?php
					$query = "select * from khoa";
					$result = mysql_query($query, $conn) or die(mysql_error());
					while ($row = mysql_fetch_array($result))
					{
						echo '<option value="'.$row['MA_KHOA'].'">'.$row['TEN_KHOA'].'</option>';
					}
				?>
			</select>
		</li>
		
		<li>
			<span>Mật khẩu</span>
			<input type="password" name="txtMK1" onkeyup="emptyCheck();">
		</li>
		
		<li>
			<span>Nhập lại mật khẩu</span>
			<input type="password" name="txtMK2" onkeyup="emptyCheck();">
		</li>
		
		<li>
			<input type="submit" value="Thêm" name="smtCNBM" disabled="true">
			<input type="reset" value="Nhập lại" name="resCNBM">
		</li>
	</ul>
</form>

</body>

</html>